const lsRoot = 'vte'

export default {
  setLs(k, v, ttl) {
    return vio.setStore(`${lsRoot}[${k}]`, v, ttl)
  },
  
  getLs(k) {
    return vio.getStore(`${lsRoot}[${k}]`)
  },
  
  core(k, ...args) {
    return args.length ? this.setLs(k, ...args) : this.getLs(k)
  },
  
  // 例: ls.remove(['token'])
  remove(keys = []) {
    if (keys.length) {
      keys.forEach(v => {
        localStorage.removeItem(`${lsRoot}[${v}]`)
      })
    }
  },
  
  token(...args) {
    return this.core('token', ...args)
  },
  
  bTimeArr(...args) {
    return this.core('buildTimeArr', ...args)
  },
  
  // 登录后待跳转的链接
  loginTargetUrl(...args) {
    return this.core('loginTargetUrl', ...args)
  },
  
}
